package liuch.priority;

/**
 * @author 17101651
 * @ClassName PriorityExtends
 * @Description 优先级具有继承的属性
 * @data 2018年09月06日
 */
public class PriorityExtends {

    public static void main(String[] args) {
        System.out.println("main thread begin priority=" + Thread.currentThread().getPriority());
        Thread.currentThread().setPriority(6);
        System.out.println("main thread end priority=" + Thread.currentThread().getPriority());
        MyThread1 myThread1 = new MyThread1();
        myThread1.start();
    }
}

class MyThread1 extends Thread {
    @Override
    public void run() {
        System.out.println(this.getName() + " " + this.getPriority());
        MyThread2 myThread2 = new MyThread2();
        myThread2.start();
    }
}

class MyThread2 extends Thread {
    @Override
    public void run() {
        System.out.println(this.getName() + " " + this.getPriority());
    }
}
